<%-- 
    Document   : smsType4
    Created on : 11 Jan, 2013, 7:00:26 PM
    Author     : sagar
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="../common/script.jsp" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <%@include file="../common/title.jsp" %>
        <script type="text/javascript">
            
            function selectSms(){
                //var centreName=document.getElementById("centerId").value;
                var id=document.getElementById("centerId");
                var centreInfo = id.options[id.selectedIndex].text;
                centreName=centreInfo.replace(/[^A-Za-z]+/g, " ");
                centerContact=centreInfo.replace(/[^0-9+]+/g, " ");
              
                var doctorName=document.getElementById("doctorId").value;
                var msBody="Dear ${customer.customerName}, You have scheduled a follow-up appointment with Dr." +doctorName+ " at  "+centreName+" Centre. For any queries, call "+centreName+" Centre("+centerContact+"). Take care";
                document.getElementById("smsType4").value=msBody;
            }
        </script>
        
        <script type="text/javascript">
            
            var rules=new Array();
            rules[0]='centerId|required|please Select centre';
            rules[1]='doctorId|required|please Select doctor name';
            
        </script>
        
    </head>
    <body onLoad="yav.init('form1',rules,'inline');">
        <%@include file="../common/header.jsp" %>
        <%@include file="../common/menu.jsp" %>
        <div class="in_02">
            <form:form id="form1" name="form1"  method="POST">
                <fieldset style="width:50%;">
                    <legend>Sending SMS For - ${smsTemplateName}</legend>
                    <table class="formTable2">
                        <tr>
                            <td style="padding-right: 0"><spring:message code="centerName"/>:<br/>
                                <select  id="centerId" name="centerId"  class="userInputMedium" onchange="selectSms();">
                                    <option value="" label="-"></option>
                                    <c:forEach items="${centerList}" var="list">
                                        <option value="${list.centerName}">${list.centerName} ~ ${list.phoneNumber} </option>
                                    </c:forEach>
                                </select><br/>
                            <span id="errorsDiv_centerId"></span>
                            </td>
                            <td style="padding-right: 0"><spring:message code="doctorName"/>:<br/>
                                <select  id="doctorId" name="doctorId"  class="userInputLarge" onchange="selectSms();">
                                    <option value="" label="-"></option>
                                    <c:forEach items="${doctorList}" var="list">
                                        <option value="${list.doctorName}">${list.doctorName} </option>
                                    </c:forEach>
                                </select><br/>
                                <span id="errorsDiv_doctorId"></span>
                            </td> 
                        </tr>
                        <tr>
                            <td colspan="2"><span class="HeadingForSms"><b>Confirmation Regarding Followup to Customer</b></span><br/><br/>
                                Message :<br/>
                                <textarea id="smsType4" name="smsType4"  value="${msBody}" class="TextAreaForSms" readonly=""/></textarea><br/>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="submit" name="_finish"  value="<spring:message code="button.sendSms"/>" onclick="return yav.performCheck('form1', rules, 'inline'); "/>
                                <input type="submit" name="_cancel"  value="<spring:message code="button.Cancel"/>"/>
                            </td>
                        </tr>
                    </table>
                </fieldset>
            </form:form>
        </div>
    </body>
</html>
